package cn.edu.hunau.oop.day04.demo;

import org.junit.Test;

/**
 * @author hb
 * @date 2025-08-07 10:41:20
 */
public class InterfaceTest {
    @Test
    public void test01(){
        Soo soo=new SooImpl();
        System.out.println(soo.add(1,2));
        System.out.println(soo.sub(1.0,2.0));
        Soo.staticMehtod();
        System.out.println(Soo.a);

    }
}

class SooImpl implements Soo{
    @Override
    public int add(int x, int y) {
        return x+y;
    }
}

@FunctionalInterface
interface Soo{
    //省略: public static  final
    int a=1;
    //省略:public abstract
    int add(int x ,int y);

    //静态方法默认使用public修饰
     public static void staticMehtod(){
        System.out.println("staticMehtod...");
    }

    //接口的default修饰的方法默认使用public修饰
    default double sub(double x,double  y){
         return x-y;
    }

    //必须使用private进行修饰:private修饰的方法为接口内部的工具方法
    private void show(){
        System.out.println("private修饰的私有的方法");
    }
}